#ifndef _WX_SELSTORE_H_
#define _WX_SELSTORE_H_

#include "wx/dynarray.h"

inline int CMPFUNC_CONV wxSizeTCmpFn( size_t n1, size_t n2 ) {
  return ( int )( n1 - n2 );
}

WX_DEFINE_SORTED_EXPORTED_ARRAY_CMP_SIZE_T( size_t,wxSizeTCmpFn,wxSelectedIndices );

class wxSelectionStore {
  public:
    wxSelectionStore() : m_itemsSel( wxSizeTCmpFn ) { Init(); }
    void SetItemCount( size_t count ) { m_count = count; }
    void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = false; }
    void OnItemAdd( size_t ( item ) ) { wxFAIL_MSG( wxT( "TODO" ) ); }
    void OnItemDelete( size_t item );
    bool SelectItem( size_t item, bool select = true );
    bool SelectRange( size_t itemFrom, size_t itemTo,bool select = true,wxArrayInt *itemsChanged = NULL );
    bool IsSelected( size_t item ) const;
    size_t GetSelectedCount() const {
      return m_defaultState ? m_count - m_itemsSel.GetCount(): m_itemsSel.GetCount();
    }
  private:
    void Init() { m_defaultState = false; }
    size_t m_count;
    bool m_defaultState;
    wxSelectedIndices m_itemsSel;
    DECLARE_NO_COPY_CLASS( wxSelectionStore )
};

#endif
